package cn.wolfcode.plus.domain;

import cn.wolfcode.plus.enums.AnnouncementEnum;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * Author wyy
 * Date 2021/2/17 14:37
 **/
@Getter
@Setter
public class Announcement {
    @TableId(type = IdType.AUTO)
    private Long id;
    private String title;
    @TableField(exist = false)
    private Employee createPerson;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date createTime;
    private Integer level;
    private Boolean ifread;
    private Boolean status;
    private String content;
    public String getLevelName(){
        return AnnouncementEnum.findStatusName(this.level);
    }
    public String toJson() {
        return JSON.toJSONString(this);
    }
}
